home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / machine / sbrkout.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  4KB  |  121 lines

  1. /***************************************************************************
  2.  
  3. Atari Super Breakout machine
  4.  
  5. If you have any questions about how this driver works, don't hesitate to
  6. ask.  - Mike Balfour (mab22@po.cwru.edu)
  7. ***************************************************************************/
  8.  
  9. #include "driver.h"
  10. #include "vidhrdw/generic.h"
  11. #include "cpu/m6502/m6502.h"
  12.  
  13. #define SBRKOUT_PROGRESSIVE 0x00
  14. #define SBRKOUT_DOUBLE      0x01
  15. #define SBRKOUT_CAVITY      0x02
  16.  
  17. int sbrkout_game_switch = SBRKOUT_PROGRESSIVE;
  18.  
  19. /***************************************************************************
  20. Interrupt
  21.  
  22. Super Breakout has a three-position dial used to select which game to
  23. play - Progressive, Double, and Cavity.  We use the interrupt to check
  24. for a key press representing one of these three choices and set our
  25. game switch appropriately.  We can't just check for key values at the time
  26. the game checks the game switch, because we would probably lose a *lot* of
  27. key presses.  Also, MAME doesn't currently support a switch control like
  28. DIP switches that's used as a runtime control.
  29. ***************************************************************************/
  30. int sbrkout_interrupt(void)
  31. {
  32.     int game_switch;
  33.  
  34.     game_switch=input_port_7_r(0);
  35.  
  36.     if (game_switch & 0x01)
  37.         sbrkout_game_switch=SBRKOUT_PROGRESSIVE;
  38.     else if (game_switch & 0x02)
  39.         sbrkout_game_switch=SBRKOUT_DOUBLE;
  40.     else if (game_switch & 0x04)
  41.         sbrkout_game_switch=SBRKOUT_CAVITY;
  42.  
  43.     return interrupt();
  44. }
  45.  
  46. READ_HANDLER( sbrkout_select1_r )
  47. {
  48.     if (sbrkout_game_switch==SBRKOUT_CAVITY)
  49.         return 0x80;
  50.     else return 0x00;
  51. }
  52.  
  53. READ_HANDLER( sbrkout_select2_r )
  54. {
  55.     if (sbrkout_game_switch==SBRKOUT_DOUBLE)
  56.         return 0x80;
  57.     else return 0x00;
  58. }
  59.  
  60. WRITE_HANDLER( sbrkout_irq_w )
  61. {
  62.         /* generate irq */
  63.         cpu_cause_interrupt(0,M6502_INT_IRQ);
  64. }
  65.  
  66.  
  67. /***************************************************************************
  68. Read DIPs
  69.  
  70. We remap all of our DIP switches from a single byte to four bytes.  This is
  71. because some of the DIP switch settings would be spread across multiple
  72. bytes, and MAME doesn't currently support that.
  73. ***************************************************************************/
  74.  
  75. READ_HANDLER( sbrkout_read_DIPs_r )
  76. {
  77.         switch (offset)
  78.         {
  79.                 /* DSW */
  80.                 case 0x00:      return ((input_port_0_r(0) & 0x03) << 6);
  81.                 case 0x01:      return ((input_port_0_r(0) & 0x0C) << 4);
  82.                 case 0x02:      return ((input_port_0_r(0) & 0xC0) << 0);
  83.                 case 0x03:      return ((input_port_0_r(0) & 0x30) << 2);
  84.  
  85.                 /* Just in case */
  86.                 default:        return 0xFF;
  87.         }
  88. }
  89.  
  90. /***************************************************************************
  91. Lamps
  92.  
  93. The LEDs are turned on and off by two consecutive memory addresses.  The
  94. first address turns them off, the second address turns them on.  This is
  95. reversed for the Serve LED, which has a NOT on the signal.
  96. ***************************************************************************/
  97. WRITE_HANDLER( sbrkout_start_1_led_w )
  98. {
  99.     if (offset==0)
  100.         osd_led_w(0,0);
  101.     else
  102.         osd_led_w(0,1);
  103. }
  104.  
  105. WRITE_HANDLER( sbrkout_start_2_led_w )
  106. {
  107.     if (offset==0)
  108.         osd_led_w(1,0);
  109.     else
  110.         osd_led_w(1,1);
  111. }
  112.  
  113. WRITE_HANDLER( sbrkout_serve_led_w )
  114. {
  115.     if (offset==0)
  116.         osd_led_w(2,1);
  117.     else
  118.         osd_led_w(2,0);
  119. }
  120.  
  121.